package org.darkforest.admin.service.impl;

import org.darkforest.admin.service.AdminLogService;
import org.darkforest.common.util.DateUtil;
import org.darkforest.dao.mapper.AdminLogMapper;
import org.darkforest.model.AdminLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by valentina on 15/6/27.
 */
@Service
public class AdminLogServiceImpl implements AdminLogService {

    @Autowired
    private AdminLogMapper adminLogMapper;


    public int addAdminLogs(String content) {
        AdminLog log = new AdminLog();
        return 0;
    }

    @Override
    public void selectListByCondition(AdminLog page) {
        page.setResultList(adminLogMapper.selectListByCondition(page));
    }

    @Override
    public int addAdminLogs(Integer adminId, String adminName, String ip, String url, String content) {
        AdminLog log = new AdminLog();
        log.setAdminId(adminId);
        log.setAdminName(adminName);
        log.setIp(ip);
        log.setUrl(url);
        log.setContent(content);
        log.setCreatetime(DateUtil.unixTimeStampInt().intValue());
        return adminLogMapper.insert(log);
    }

    @Override
    public int deleteByIds(List nList) {
        return adminLogMapper.deleteByIds(nList);
    }
}
